<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Date and Time Functions</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GLib 参考手册">
<link rel="up" href="glib-utilities.html" title="GLib工具">
<link rel="prev" href="glib-I18N.html" title="Internationalization">
<link rel="next" href="glib-GTimeZone.html" title="GTimeZone">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="glib-I18N.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="glib-utilities.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GLib 参考手册</th>
<td><a accesskey="n" href="glib-GTimeZone.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#glib-Date-and-Time-Functions.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#glib-Date-and-Time-Functions.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="glib-Date-and-Time-Functions"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="glib-Date-and-Time-Functions.top_of_page"></a>Date and Time Functions</span></h2>
<p>Date and Time Functions — calendrical calculations and miscellaneous time stuff</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="glib-Date-and-Time-Functions.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;glib.h&gt;

#define             <a class="link" href="glib-Date-and-Time-Functions.html#G-USEC-PER-SEC:CAPS" title="G_USEC_PER_SEC">G_USEC_PER_SEC</a>
struct              <a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="struct GTimeVal">GTimeVal</a>;
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-get-current-time" title="g_get_current_time ()">g_get_current_time</a>                  (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="struct GTimeVal"><span class="type">GTimeVal</span></a> *result</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-usleep" title="g_usleep ()">g_usleep</a>                            (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gulong" title="gulong"><span class="type">gulong</span></a> microseconds</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-time-val-add" title="g_time_val_add ()">g_time_val_add</a>                      (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="struct GTimeVal"><span class="type">GTimeVal</span></a> *time_</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> microseconds</code></em>);
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Date-and-Time-Functions.html#g-time-val-from-iso8601" title="g_time_val_from_iso8601 ()">g_time_val_from_iso8601</a>             (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *iso_date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="struct GTimeVal"><span class="type">GTimeVal</span></a> *time_</code></em>);
<a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *             <a class="link" href="glib-Date-and-Time-Functions.html#g-time-val-to-iso8601" title="g_time_val_to_iso8601 ()">g_time_val_to_iso8601</a>               (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="struct GTimeVal"><span class="type">GTimeVal</span></a> *time_</code></em>);

<a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="returnvalue">gint64</span></a>              <a class="link" href="glib-Date-and-Time-Functions.html#g-get-monotonic-time" title="g_get_monotonic_time ()">g_get_monotonic_time</a>                (<em class="parameter"><code><span class="type">void</span></code></em>);
<a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="returnvalue">gint64</span></a>              <a class="link" href="glib-Date-and-Time-Functions.html#g-get-real-time" title="g_get_real_time ()">g_get_real_time</a>                     (<em class="parameter"><code><span class="type">void</span></code></em>);

struct              <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate">GDate</a>;
typedef             <a class="link" href="glib-Date-and-Time-Functions.html#GTime" title="GTime">GTime</a>;
enum                <a class="link" href="glib-Date-and-Time-Functions.html#GDateDMY" title="enum GDateDMY">GDateDMY</a>;
typedef             <a class="link" href="glib-Date-and-Time-Functions.html#GDateDay" title="GDateDay">GDateDay</a>;
enum                <a class="link" href="glib-Date-and-Time-Functions.html#GDateMonth" title="enum GDateMonth">GDateMonth</a>;
typedef             <a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear">GDateYear</a>;
enum                <a class="link" href="glib-Date-and-Time-Functions.html#GDateWeekday" title="enum GDateWeekday">GDateWeekday</a>;

#define             <a class="link" href="glib-Date-and-Time-Functions.html#G-DATE-BAD-DAY:CAPS" title="G_DATE_BAD_DAY">G_DATE_BAD_DAY</a>
#define             <a class="link" href="glib-Date-and-Time-Functions.html#G-DATE-BAD-JULIAN:CAPS" title="G_DATE_BAD_JULIAN">G_DATE_BAD_JULIAN</a>
#define             <a class="link" href="glib-Date-and-Time-Functions.html#G-DATE-BAD-YEAR:CAPS" title="G_DATE_BAD_YEAR">G_DATE_BAD_YEAR</a>

<a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="returnvalue">GDate</span></a> *             <a class="link" href="glib-Date-and-Time-Functions.html#g-date-new" title="g_date_new ()">g_date_new</a>                          (<em class="parameter"><code><span class="type">void</span></code></em>);
<a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="returnvalue">GDate</span></a> *             <a class="link" href="glib-Date-and-Time-Functions.html#g-date-new-dmy" title="g_date_new_dmy ()">g_date_new_dmy</a>                      (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateDay" title="GDateDay"><span class="type">GDateDay</span></a> day</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateMonth" title="enum GDateMonth"><span class="type">GDateMonth</span></a> month</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="type">GDateYear</span></a> year</code></em>);
<a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="returnvalue">GDate</span></a> *             <a class="link" href="glib-Date-and-Time-Functions.html#g-date-new-julian" title="g_date_new_julian ()">g_date_new_julian</a>                   (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="type">guint32</span></a> julian_day</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-clear" title="g_date_clear ()">g_date_clear</a>                        (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> n_dates</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-free" title="g_date_free ()">g_date_free</a>                         (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);

<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-set-day" title="g_date_set_day ()">g_date_set_day</a>                      (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateDay" title="GDateDay"><span class="type">GDateDay</span></a> day</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-set-month" title="g_date_set_month ()">g_date_set_month</a>                    (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateMonth" title="enum GDateMonth"><span class="type">GDateMonth</span></a> month</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-set-year" title="g_date_set_year ()">g_date_set_year</a>                     (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="type">GDateYear</span></a> year</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-set-dmy" title="g_date_set_dmy ()">g_date_set_dmy</a>                      (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateDay" title="GDateDay"><span class="type">GDateDay</span></a> day</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateMonth" title="enum GDateMonth"><span class="type">GDateMonth</span></a> month</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="type">GDateYear</span></a> y</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-set-julian" title="g_date_set_julian ()">g_date_set_julian</a>                   (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="type">guint32</span></a> julian_date</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-set-time" title="g_date_set_time ()">g_date_set_time</a>                     (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GTime" title="GTime"><span class="type">GTime</span></a> time_</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-set-time-t" title="g_date_set_time_t ()">g_date_set_time_t</a>                   (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><span class="type">time_t</span> timet</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-set-time-val" title="g_date_set_time_val ()">g_date_set_time_val</a>                 (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="struct GTimeVal"><span class="type">GTimeVal</span></a> *timeval</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-set-parse" title="g_date_set_parse ()">g_date_set_parse</a>                    (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>);

<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-add-days" title="g_date_add_days ()">g_date_add_days</a>                     (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> n_days</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-subtract-days" title="g_date_subtract_days ()">g_date_subtract_days</a>                (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> n_days</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-add-months" title="g_date_add_months ()">g_date_add_months</a>                   (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> n_months</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-subtract-months" title="g_date_subtract_months ()">g_date_subtract_months</a>              (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> n_months</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-add-years" title="g_date_add_years ()">g_date_add_years</a>                    (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> n_years</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-subtract-years" title="g_date_subtract_years ()">g_date_subtract_years</a>               (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> n_years</code></em>);
<a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-days-between" title="g_date_days_between ()">g_date_days_between</a>                 (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date1</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date2</code></em>);
<a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-compare" title="g_date_compare ()">g_date_compare</a>                      (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *lhs</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *rhs</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-clamp" title="g_date_clamp ()">g_date_clamp</a>                        (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *min_date</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *max_date</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-order" title="g_date_order ()">g_date_order</a>                        (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date1</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date2</code></em>);

<a class="link" href="glib-Date-and-Time-Functions.html#GDateDay" title="GDateDay"><span class="returnvalue">GDateDay</span></a>            <a class="link" href="glib-Date-and-Time-Functions.html#g-date-get-day" title="g_date_get_day ()">g_date_get_day</a>                      (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);
<a class="link" href="glib-Date-and-Time-Functions.html#GDateMonth" title="enum GDateMonth"><span class="returnvalue">GDateMonth</span></a>          <a class="link" href="glib-Date-and-Time-Functions.html#g-date-get-month" title="g_date_get_month ()">g_date_get_month</a>                    (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);
<a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="returnvalue">GDateYear</span></a>           <a class="link" href="glib-Date-and-Time-Functions.html#g-date-get-year" title="g_date_get_year ()">g_date_get_year</a>                     (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);
<a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="returnvalue">guint32</span></a>             <a class="link" href="glib-Date-and-Time-Functions.html#g-date-get-julian" title="g_date_get_julian ()">g_date_get_julian</a>                   (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);
<a class="link" href="glib-Date-and-Time-Functions.html#GDateWeekday" title="enum GDateWeekday"><span class="returnvalue">GDateWeekday</span></a>        <a class="link" href="glib-Date-and-Time-Functions.html#g-date-get-weekday" title="g_date_get_weekday ()">g_date_get_weekday</a>                  (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);
<a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               <a class="link" href="glib-Date-and-Time-Functions.html#g-date-get-day-of-year" title="g_date_get_day_of_year ()">g_date_get_day_of_year</a>              (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);

<a class="link" href="glib-Basic-Types.html#guint8" title="guint8"><span class="returnvalue">guint8</span></a>              <a class="link" href="glib-Date-and-Time-Functions.html#g-date-get-days-in-month" title="g_date_get_days_in_month ()">g_date_get_days_in_month</a>            (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateMonth" title="enum GDateMonth"><span class="type">GDateMonth</span></a> month</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="type">GDateYear</span></a> year</code></em>);
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Date-and-Time-Functions.html#g-date-is-first-of-month" title="g_date_is_first_of_month ()">g_date_is_first_of_month</a>            (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Date-and-Time-Functions.html#g-date-is-last-of-month" title="g_date_is_last_of_month ()">g_date_is_last_of_month</a>             (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Date-and-Time-Functions.html#g-date-is-leap-year" title="g_date_is_leap_year ()">g_date_is_leap_year</a>                 (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="type">GDateYear</span></a> year</code></em>);
<a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               <a class="link" href="glib-Date-and-Time-Functions.html#g-date-get-monday-week-of-year" title="g_date_get_monday_week_of_year ()">g_date_get_monday_week_of_year</a>      (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);
<a class="link" href="glib-Basic-Types.html#guint8" title="guint8"><span class="returnvalue">guint8</span></a>              <a class="link" href="glib-Date-and-Time-Functions.html#g-date-get-monday-weeks-in-year" title="g_date_get_monday_weeks_in_year ()">g_date_get_monday_weeks_in_year</a>     (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="type">GDateYear</span></a> year</code></em>);
<a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               <a class="link" href="glib-Date-and-Time-Functions.html#g-date-get-sunday-week-of-year" title="g_date_get_sunday_week_of_year ()">g_date_get_sunday_week_of_year</a>      (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);
<a class="link" href="glib-Basic-Types.html#guint8" title="guint8"><span class="returnvalue">guint8</span></a>              <a class="link" href="glib-Date-and-Time-Functions.html#g-date-get-sunday-weeks-in-year" title="g_date_get_sunday_weeks_in_year ()">g_date_get_sunday_weeks_in_year</a>     (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="type">GDateYear</span></a> year</code></em>);
<a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               <a class="link" href="glib-Date-and-Time-Functions.html#g-date-get-iso8601-week-of-year" title="g_date_get_iso8601_week_of_year ()">g_date_get_iso8601_week_of_year</a>     (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);

<a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>               <a class="link" href="glib-Date-and-Time-Functions.html#g-date-strftime" title="g_date_strftime ()">g_date_strftime</a>                     (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> slen</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Date-and-Time-Functions.html#g-date-to-struct-tm" title="g_date_to_struct_tm ()">g_date_to_struct_tm</a>                 (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><span class="type">struct tm</span> *tm</code></em>);

<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Date-and-Time-Functions.html#g-date-valid" title="g_date_valid ()">g_date_valid</a>                        (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Date-and-Time-Functions.html#g-date-valid-day" title="g_date_valid_day ()">g_date_valid_day</a>                    (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateDay" title="GDateDay"><span class="type">GDateDay</span></a> day</code></em>);
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Date-and-Time-Functions.html#g-date-valid-month" title="g_date_valid_month ()">g_date_valid_month</a>                  (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateMonth" title="enum GDateMonth"><span class="type">GDateMonth</span></a> month</code></em>);
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Date-and-Time-Functions.html#g-date-valid-year" title="g_date_valid_year ()">g_date_valid_year</a>                   (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="type">GDateYear</span></a> year</code></em>);
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Date-and-Time-Functions.html#g-date-valid-dmy" title="g_date_valid_dmy ()">g_date_valid_dmy</a>                    (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateDay" title="GDateDay"><span class="type">GDateDay</span></a> day</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateMonth" title="enum GDateMonth"><span class="type">GDateMonth</span></a> month</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="type">GDateYear</span></a> year</code></em>);
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Date-and-Time-Functions.html#g-date-valid-julian" title="g_date_valid_julian ()">g_date_valid_julian</a>                 (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="type">guint32</span></a> julian_date</code></em>);
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Date-and-Time-Functions.html#g-date-valid-weekday" title="g_date_valid_weekday ()">g_date_valid_weekday</a>                (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateWeekday" title="enum GDateWeekday"><span class="type">GDateWeekday</span></a> weekday</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="glib-Date-and-Time-Functions.description"></a><h2>Description</h2>
<p>
The <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> data structure represents a day between January 1, Year 1,
and sometime a few thousand years in the future (right now it will go
to the year 65535 or so, but <a class="link" href="glib-Date-and-Time-Functions.html#g-date-set-parse" title="g_date_set_parse ()"><code class="function">g_date_set_parse()</code></a> only parses up to the
year 8000 or so - just count on "a few thousand"). <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> is meant to
represent everyday dates, not astronomical dates or historical dates
or ISO timestamps or the like. It extrapolates the current Gregorian
calendar forward and backward in time; there is no attempt to change
the calendar to match time periods or locations. <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> does not store
time information; it represents a <span class="emphasis"><em>day</em></span>.
</p>
<p>
The <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> implementation has several nice features; it is only a
64-bit struct, so storing large numbers of dates is very efficient. It
can keep both a Julian and day-month-year representation of the date,
since some calculations are much easier with one representation or the
other. A Julian representation is simply a count of days since some
fixed day in the past; for <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> the fixed day is January 1, 1 AD.
("Julian" dates in the <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> API aren't really Julian dates in the
technical sense; technically, Julian dates count from the start of the
Julian period, Jan 1, 4713 BC).
</p>
<p>
<a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> is simple to use. First you need a "blank" date; you can get a
dynamically allocated date from <a class="link" href="glib-Date-and-Time-Functions.html#g-date-new" title="g_date_new ()"><code class="function">g_date_new()</code></a>, or you can declare an
automatic variable or array and initialize it to a sane state by
calling <a class="link" href="glib-Date-and-Time-Functions.html#g-date-clear" title="g_date_clear ()"><code class="function">g_date_clear()</code></a>. A cleared date is sane; it's safe to call
<a class="link" href="glib-Date-and-Time-Functions.html#g-date-set-dmy" title="g_date_set_dmy ()"><code class="function">g_date_set_dmy()</code></a> and the other mutator functions to initialize the
value of a cleared date. However, a cleared date is initially
<span class="emphasis"><em>invalid</em></span>, meaning that it doesn't represent a day
that exists. It is undefined to call any of the date calculation
routines on an invalid date. If you obtain a date from a user or other
unpredictable source, you should check its validity with the
<a class="link" href="glib-Date-and-Time-Functions.html#g-date-valid" title="g_date_valid ()"><code class="function">g_date_valid()</code></a> predicate. <a class="link" href="glib-Date-and-Time-Functions.html#g-date-valid" title="g_date_valid ()"><code class="function">g_date_valid()</code></a> is also used to check for
errors with <a class="link" href="glib-Date-and-Time-Functions.html#g-date-set-parse" title="g_date_set_parse ()"><code class="function">g_date_set_parse()</code></a> and other functions that can
fail. Dates can be invalidated by calling <a class="link" href="glib-Date-and-Time-Functions.html#g-date-clear" title="g_date_clear ()"><code class="function">g_date_clear()</code></a> again.
</p>
<p>
<span class="emphasis"><em>It is very important to use the API to access the <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>
struct.</em></span> Often only the day-month-year or only the Julian
representation is valid. Sometimes neither is valid. Use the API.
</p>
<p>
GLib also features <a class="link" href="glib-GDateTime.html#GDateTime" title="GDateTime"><span class="type">GDateTime</span></a> which represents a precise time.
</p>
</div>
<div class="refsect1">
<a name="glib-Date-and-Time-Functions.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="G-USEC-PER-SEC:CAPS"></a><h3>G_USEC_PER_SEC</h3>
<pre class="programlisting">#define G_USEC_PER_SEC 1000000
</pre>
<p>
Number of microseconds in one second (1 million).
This macro is provided for code readability.
</p>
</div>
<hr>
<div class="refsect2">
<a name="GTimeVal"></a><h3>struct GTimeVal</h3>
<pre class="programlisting">struct GTimeVal {
  glong tv_sec;
  glong tv_usec;
};
</pre>
<p>
Represents a precise time, with seconds and microseconds.
Similar to the <span class="structname">struct timeval</span> returned by
the <code class="function">gettimeofday()</code> UNIX system call.
</p>
<p>
GLib is attempting to unify around the use of 64bit integers to
represent microsecond-precision time. As such, this type will be
removed from a future version of GLib.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> <em class="structfield"><code><a name="GTimeVal.tv-sec"></a>tv_sec</code></em>;</span></p></td>
<td>seconds</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> <em class="structfield"><code><a name="GTimeVal.tv-usec"></a>tv_usec</code></em>;</span></p></td>
<td>microseconds</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-get-current-time"></a><h3>g_get_current_time ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_get_current_time                  (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="struct GTimeVal"><span class="type">GTimeVal</span></a> *result</code></em>);</pre>
<p>
Equivalent to the UNIX <code class="function">gettimeofday()</code> function, but portable.
</p>
<p>
You may find <a class="link" href="glib-Date-and-Time-Functions.html#g-get-real-time" title="g_get_real_time ()"><code class="function">g_get_real_time()</code></a> to be more convenient.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>result</code></em> :</span></p></td>
<td>
<a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="struct GTimeVal"><span class="type">GTimeVal</span></a> structure in which to store current time.</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-usleep"></a><h3>g_usleep ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_usleep                            (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gulong" title="gulong"><span class="type">gulong</span></a> microseconds</code></em>);</pre>
<p>
Pauses the current thread for the given number of microseconds.
</p>
<p>
There are 1 million microseconds per second (represented by the
<a class="link" href="glib-Date-and-Time-Functions.html#G-USEC-PER-SEC:CAPS" title="G_USEC_PER_SEC"><span class="type">G_USEC_PER_SEC</span></a> macro). <a class="link" href="glib-Date-and-Time-Functions.html#g-usleep" title="g_usleep ()"><code class="function">g_usleep()</code></a> may have limited precision,
depending on hardware and operating system; don't rely on the exact
length of the sleep.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>microseconds</code></em> :</span></p></td>
<td>number of microseconds to pause</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-time-val-add"></a><h3>g_time_val_add ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_time_val_add                      (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="struct GTimeVal"><span class="type">GTimeVal</span></a> *time_</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> microseconds</code></em>);</pre>
<p>
Adds the given number of microseconds to <em class="parameter"><code>time_</code></em>. <em class="parameter"><code>microseconds</code></em> can
also be negative to decrease the value of <em class="parameter"><code>time_</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>time_</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="struct GTimeVal"><span class="type">GTimeVal</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>microseconds</code></em> :</span></p></td>
<td>number of microseconds to add to <em class="parameter"><code>time</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-time-val-from-iso8601"></a><h3>g_time_val_from_iso8601 ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_time_val_from_iso8601             (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *iso_date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="struct GTimeVal"><span class="type">GTimeVal</span></a> *time_</code></em>);</pre>
<p>
Converts a string containing an ISO 8601 encoded date and time
to a <a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="struct GTimeVal"><span class="type">GTimeVal</span></a> and puts it into <em class="parameter"><code>time_</code></em>.
</p>
<p>
<em class="parameter"><code>iso_date</code></em> must include year, month, day, hours, minutes, and
seconds. It can optionally include fractions of a second and a time
zone indicator. (In the absence of any time zone indication, the
timestamp is assumed to be in local time.)
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>iso_date</code></em> :</span></p></td>
<td>an ISO 8601 encoded date string</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>time_</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="struct GTimeVal"><span class="type">GTimeVal</span></a>. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the conversion was successful.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.12</p>
</div>
<hr>
<div class="refsect2">
<a name="g-time-val-to-iso8601"></a><h3>g_time_val_to_iso8601 ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *             g_time_val_to_iso8601               (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="struct GTimeVal"><span class="type">GTimeVal</span></a> *time_</code></em>);</pre>
<p>
Converts <em class="parameter"><code>time_</code></em> into an RFC 3339 encoded string, relative to the
Coordinated Universal Time (UTC). This is one of the many formats
allowed by ISO 8601.
</p>
<p>
ISO 8601 allows a large number of date/time formats, with or without
punctuation and optional elements. The format returned by this function
is a complete date and time, with optional punctuation included, the
UTC time zone represented as "Z", and the <em class="parameter"><code>tv_usec</code></em> part included if
and only if it is nonzero, i.e. either
"YYYY-MM-DDTHH:MM:SSZ" or "YYYY-MM-DDTHH:MM:SS.fffffZ".
</p>
<p>
This corresponds to the Internet date/time format defined by
<a class="ulink" href="https://www.ietf.org/rfc/rfc3339.txt" target="_top">RFC 3339</a>, and
to either of the two most-precise formats defined by
<a class="ulink" href="http://www.w3.org/TR/NOTE-datetime-19980827" target="_top">the W3C Note
"Date and Time Formats"</a>. Both of these documents are profiles of
ISO 8601.
</p>
<p>
Use <a class="link" href="glib-GDateTime.html#g-date-time-format" title="g_date_time_format ()"><code class="function">g_date_time_format()</code></a> or <a class="link" href="glib-String-Utility-Functions.html#g-strdup-printf" title="g_strdup_printf ()"><code class="function">g_strdup_printf()</code></a> if a different
variation of ISO 8601 format is required.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>time_</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="struct GTimeVal"><span class="type">GTimeVal</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a newly allocated string containing an ISO 8601 date</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.12</p>
</div>
<hr>
<div class="refsect2">
<a name="g-get-monotonic-time"></a><h3>g_get_monotonic_time ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="returnvalue">gint64</span></a>              g_get_monotonic_time                (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Queries the system monotonic time, if available.
</p>
<p>
On POSIX systems with <code class="function">clock_gettime()</code> and <code class="literal">CLOCK_MONOTONIC</code> this call
is a very shallow wrapper for that.  Otherwise, we make a best effort
that probably involves returning the wall clock time (with at least
microsecond accuracy, subject to the limitations of the OS kernel).
</p>
<p>
It's important to note that POSIX <code class="literal">CLOCK_MONOTONIC</code> does
not count time spent while the machine is suspended.
</p>
<p>
On Windows, "limitations of the OS kernel" is a rather substantial
statement.  Depending on the configuration of the system, the wall
clock time is updated as infrequently as 64 times a second (which
is approximately every 16ms). Also, on XP (but not on Vista or later)
the monotonic clock is locally monotonic, but may differ in exact
value between processes due to timer wrap handling.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the monotonic time, in microseconds</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-get-real-time"></a><h3>g_get_real_time ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint64" title="gint64"><span class="returnvalue">gint64</span></a>              g_get_real_time                     (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Queries the system wall-clock time.
</p>
<p>
This call is functionally equivalent to <a class="link" href="glib-Date-and-Time-Functions.html#g-get-current-time" title="g_get_current_time ()"><code class="function">g_get_current_time()</code></a> except
that the return value is often more convenient than dealing with a
<a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="struct GTimeVal"><span class="type">GTimeVal</span></a>.
</p>
<p>
You should only use this call if you are actually interested in the real
wall-clock time.  <a class="link" href="glib-Date-and-Time-Functions.html#g-get-monotonic-time" title="g_get_monotonic_time ()"><code class="function">g_get_monotonic_time()</code></a> is probably more useful for
measuring intervals.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the number of microseconds since January 1, 1970 UTC.</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="GDate"></a><h3>struct GDate</h3>
<pre class="programlisting">struct GDate {
  guint julian_days : 32; /* julian days representation - we use a
                           *  bitfield hoping that 64 bit platforms
                           *  will pack this whole struct in one big
                           *  int
                           */

  guint julian : 1;    /* julian is valid */
  guint dmy    : 1;    /* dmy is valid */

  /* DMY representation */
  guint day    : 6;
  guint month  : 4;
  guint year   : 16;
};
</pre>
<p>
Represents a day between January 1, Year 1 and a few thousand years in
the future. None of its members should be accessed directly. If the
<span class="structname">GDate</span> is obtained from <a class="link" href="glib-Date-and-Time-Functions.html#g-date-new" title="g_date_new ()"><code class="function">g_date_new()</code></a>, it will
be safe to mutate but invalid and thus not safe for calendrical
computations. If it's declared on the stack, it will contain garbage
so must be initialized with <a class="link" href="glib-Date-and-Time-Functions.html#g-date-clear" title="g_date_clear ()"><code class="function">g_date_clear()</code></a>. <a class="link" href="glib-Date-and-Time-Functions.html#g-date-clear" title="g_date_clear ()"><code class="function">g_date_clear()</code></a> makes the
date invalid but sane. An invalid date doesn't represent a day, it's
"empty." A date becomes valid after you set it to a Julian day or you
set a day, month, and year.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> <em class="structfield"><code><a name="GDate.julian-days"></a>julian_days</code></em> : 32;</span></p></td>
<td>the Julian representation of the date</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> <em class="structfield"><code><a name="GDate.julian"></a>julian</code></em> : 1;</span></p></td>
<td>this bit is set if <em class="parameter"><code>julian_days</code></em> is valid</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> <em class="structfield"><code><a name="GDate.dmy"></a>dmy</code></em> : 1;</span></p></td>
<td>this is set if <em class="parameter"><code>day</code></em>, <em class="parameter"><code>month</code></em> and <em class="parameter"><code>year</code></em> are valid</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> <em class="structfield"><code><a name="GDate.day"></a>day</code></em> : 6;</span></p></td>
<td>the day of the day-month-year representation of the date,
as a number between 1 and 31</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> <em class="structfield"><code><a name="GDate.month"></a>month</code></em> : 4;</span></p></td>
<td>the day of the day-month-year representation of the date,
as a number between 1 and 12</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> <em class="structfield"><code><a name="GDate.year"></a>year</code></em> : 16;</span></p></td>
<td>the day of the day-month-year representation of the date</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GTime"></a><h3>GTime</h3>
<pre class="programlisting">typedef gint32  GTime;
</pre>
<p>
Simply a replacement for <span class="type">time_t</span>. It has been deprecated
since it is <span class="emphasis"><em>not</em></span> equivalent to <span class="type">time_t</span>
on 64-bit platforms with a 64-bit <span class="type">time_t</span>.
Unrelated to <a class="link" href="glib-Timers.html#GTimer" title="GTimer"><span class="type">GTimer</span></a>.
</p>
<p>
Note that <span class="type">GTime</span> is defined to always be a 32bit integer,
unlike <span class="type">time_t</span> which may be 64bit on some systems.
Therefore, <span class="type">GTime</span> will overflow in the year 2038, and
you cannot use the address of a <span class="type">GTime</span> variable as argument
to the UNIX <code class="function">time()</code> function. Instead, do the following:
</p>
<div class="informalexample"><pre class="programlisting">
time_t ttime;
GTime gtime;

time (&amp;ttime);
gtime = (GTime)ttime;
</pre></div>
<p>
</p>
</div>
<hr>
<div class="refsect2">
<a name="GDateDMY"></a><h3>enum GDateDMY</h3>
<pre class="programlisting">typedef enum {
  G_DATE_DAY   = 0,
  G_DATE_MONTH = 1,
  G_DATE_YEAR  = 2
} GDateDMY;
</pre>
<p>
This enumeration isn't used in the API, but may be useful if you need
to mark a number as a day, month, or year.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="G-DATE-DAY:CAPS"></a><span class="term"><code class="literal">G_DATE_DAY</code></span></p></td>
<td>a day
</td>
</tr>
<tr>
<td><p><a name="G-DATE-MONTH:CAPS"></a><span class="term"><code class="literal">G_DATE_MONTH</code></span></p></td>
<td>a month
</td>
</tr>
<tr>
<td><p><a name="G-DATE-YEAR:CAPS"></a><span class="term"><code class="literal">G_DATE_YEAR</code></span></p></td>
<td>a year
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GDateDay"></a><h3>GDateDay</h3>
<pre class="programlisting">typedef guint8  GDateDay;   /* day of the month */
</pre>
<p>
Integer representing a day of the month; between 1 and
31. <a class="link" href="glib-Date-and-Time-Functions.html#G-DATE-BAD-DAY:CAPS" title="G_DATE_BAD_DAY"><span class="type">G_DATE_BAD_DAY</span></a> represents an invalid day of the month.
</p>
</div>
<hr>
<div class="refsect2">
<a name="GDateMonth"></a><h3>enum GDateMonth</h3>
<pre class="programlisting">typedef enum {
  G_DATE_BAD_MONTH = 0,
  G_DATE_JANUARY   = 1,
  G_DATE_FEBRUARY  = 2,
  G_DATE_MARCH     = 3,
  G_DATE_APRIL     = 4,
  G_DATE_MAY       = 5,
  G_DATE_JUNE      = 6,
  G_DATE_JULY      = 7,
  G_DATE_AUGUST    = 8,
  G_DATE_SEPTEMBER = 9,
  G_DATE_OCTOBER   = 10,
  G_DATE_NOVEMBER  = 11,
  G_DATE_DECEMBER  = 12
} GDateMonth;
</pre>
<p>
Enumeration representing a month; values are <a class="link" href="glib-Date-and-Time-Functions.html#G-DATE-JANUARY:CAPS"><span class="type">G_DATE_JANUARY</span></a>,
<a class="link" href="glib-Date-and-Time-Functions.html#G-DATE-FEBRUARY:CAPS"><span class="type">G_DATE_FEBRUARY</span></a>, etc. <a class="link" href="glib-Date-and-Time-Functions.html#G-DATE-BAD-MONTH:CAPS"><span class="type">G_DATE_BAD_MONTH</span></a> is the invalid value.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="G-DATE-BAD-MONTH:CAPS"></a><span class="term"><code class="literal">G_DATE_BAD_MONTH</code></span></p></td>
<td>invalid value
</td>
</tr>
<tr>
<td><p><a name="G-DATE-JANUARY:CAPS"></a><span class="term"><code class="literal">G_DATE_JANUARY</code></span></p></td>
<td>January
</td>
</tr>
<tr>
<td><p><a name="G-DATE-FEBRUARY:CAPS"></a><span class="term"><code class="literal">G_DATE_FEBRUARY</code></span></p></td>
<td>February
</td>
</tr>
<tr>
<td><p><a name="G-DATE-MARCH:CAPS"></a><span class="term"><code class="literal">G_DATE_MARCH</code></span></p></td>
<td>March
</td>
</tr>
<tr>
<td><p><a name="G-DATE-APRIL:CAPS"></a><span class="term"><code class="literal">G_DATE_APRIL</code></span></p></td>
<td>April
</td>
</tr>
<tr>
<td><p><a name="G-DATE-MAY:CAPS"></a><span class="term"><code class="literal">G_DATE_MAY</code></span></p></td>
<td>May
</td>
</tr>
<tr>
<td><p><a name="G-DATE-JUNE:CAPS"></a><span class="term"><code class="literal">G_DATE_JUNE</code></span></p></td>
<td>June
</td>
</tr>
<tr>
<td><p><a name="G-DATE-JULY:CAPS"></a><span class="term"><code class="literal">G_DATE_JULY</code></span></p></td>
<td>July
</td>
</tr>
<tr>
<td><p><a name="G-DATE-AUGUST:CAPS"></a><span class="term"><code class="literal">G_DATE_AUGUST</code></span></p></td>
<td>August
</td>
</tr>
<tr>
<td><p><a name="G-DATE-SEPTEMBER:CAPS"></a><span class="term"><code class="literal">G_DATE_SEPTEMBER</code></span></p></td>
<td>September
</td>
</tr>
<tr>
<td><p><a name="G-DATE-OCTOBER:CAPS"></a><span class="term"><code class="literal">G_DATE_OCTOBER</code></span></p></td>
<td>October
</td>
</tr>
<tr>
<td><p><a name="G-DATE-NOVEMBER:CAPS"></a><span class="term"><code class="literal">G_DATE_NOVEMBER</code></span></p></td>
<td>November
</td>
</tr>
<tr>
<td><p><a name="G-DATE-DECEMBER:CAPS"></a><span class="term"><code class="literal">G_DATE_DECEMBER</code></span></p></td>
<td>December
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GDateYear"></a><h3>GDateYear</h3>
<pre class="programlisting">typedef guint16 GDateYear;
</pre>
<p>
Integer representing a year; <a class="link" href="glib-Date-and-Time-Functions.html#G-DATE-BAD-YEAR:CAPS" title="G_DATE_BAD_YEAR"><span class="type">G_DATE_BAD_YEAR</span></a> is the invalid
value. The year must be 1 or higher; negative (BC) years are not
allowed. The year is represented with four digits.
</p>
</div>
<hr>
<div class="refsect2">
<a name="GDateWeekday"></a><h3>enum GDateWeekday</h3>
<pre class="programlisting">typedef enum {
  G_DATE_BAD_WEEKDAY  = 0,
  G_DATE_MONDAY       = 1,
  G_DATE_TUESDAY      = 2,
  G_DATE_WEDNESDAY    = 3,
  G_DATE_THURSDAY     = 4,
  G_DATE_FRIDAY       = 5,
  G_DATE_SATURDAY     = 6,
  G_DATE_SUNDAY       = 7
} GDateWeekday;
</pre>
<p>
Enumeration representing a day of the week; <a class="link" href="glib-Date-and-Time-Functions.html#G-DATE-MONDAY:CAPS"><span class="type">G_DATE_MONDAY</span></a>,
<a class="link" href="glib-Date-and-Time-Functions.html#G-DATE-TUESDAY:CAPS"><span class="type">G_DATE_TUESDAY</span></a>, etc. <a class="link" href="glib-Date-and-Time-Functions.html#G-DATE-BAD-WEEKDAY:CAPS"><span class="type">G_DATE_BAD_WEEKDAY</span></a> is an invalid weekday.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="G-DATE-BAD-WEEKDAY:CAPS"></a><span class="term"><code class="literal">G_DATE_BAD_WEEKDAY</code></span></p></td>
<td>invalid value
</td>
</tr>
<tr>
<td><p><a name="G-DATE-MONDAY:CAPS"></a><span class="term"><code class="literal">G_DATE_MONDAY</code></span></p></td>
<td>Monday
</td>
</tr>
<tr>
<td><p><a name="G-DATE-TUESDAY:CAPS"></a><span class="term"><code class="literal">G_DATE_TUESDAY</code></span></p></td>
<td>Tuesday
</td>
</tr>
<tr>
<td><p><a name="G-DATE-WEDNESDAY:CAPS"></a><span class="term"><code class="literal">G_DATE_WEDNESDAY</code></span></p></td>
<td>Wednesday
</td>
</tr>
<tr>
<td><p><a name="G-DATE-THURSDAY:CAPS"></a><span class="term"><code class="literal">G_DATE_THURSDAY</code></span></p></td>
<td>Thursday
</td>
</tr>
<tr>
<td><p><a name="G-DATE-FRIDAY:CAPS"></a><span class="term"><code class="literal">G_DATE_FRIDAY</code></span></p></td>
<td>Friday
</td>
</tr>
<tr>
<td><p><a name="G-DATE-SATURDAY:CAPS"></a><span class="term"><code class="literal">G_DATE_SATURDAY</code></span></p></td>
<td>Saturday
</td>
</tr>
<tr>
<td><p><a name="G-DATE-SUNDAY:CAPS"></a><span class="term"><code class="literal">G_DATE_SUNDAY</code></span></p></td>
<td>Sunday
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="G-DATE-BAD-DAY:CAPS"></a><h3>G_DATE_BAD_DAY</h3>
<pre class="programlisting">#define G_DATE_BAD_DAY    0U
</pre>
<p>
Represents an invalid <a class="link" href="glib-Date-and-Time-Functions.html#GDateDay" title="GDateDay"><span class="type">GDateDay</span></a>.
</p>
</div>
<hr>
<div class="refsect2">
<a name="G-DATE-BAD-JULIAN:CAPS"></a><h3>G_DATE_BAD_JULIAN</h3>
<pre class="programlisting">#define G_DATE_BAD_JULIAN 0U
</pre>
<p>
Represents an invalid Julian day number.
</p>
</div>
<hr>
<div class="refsect2">
<a name="G-DATE-BAD-YEAR:CAPS"></a><h3>G_DATE_BAD_YEAR</h3>
<pre class="programlisting">#define G_DATE_BAD_YEAR   0U
</pre>
<p>
Represents an invalid year.
</p>
</div>
<hr>
<div class="refsect2">
<a name="g-date-new"></a><h3>g_date_new ()</h3>
<pre class="programlisting"><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="returnvalue">GDate</span></a> *             g_date_new                          (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Allocates a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> and initializes
it to a sane state. The new date will
be cleared (as if you'd called <a class="link" href="glib-Date-and-Time-Functions.html#g-date-clear" title="g_date_clear ()"><code class="function">g_date_clear()</code></a>) but invalid (it won't
represent an existing day). Free the return value with <a class="link" href="glib-Date-and-Time-Functions.html#g-date-free" title="g_date_free ()"><code class="function">g_date_free()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a newly-allocated <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-new-dmy"></a><h3>g_date_new_dmy ()</h3>
<pre class="programlisting"><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="returnvalue">GDate</span></a> *             g_date_new_dmy                      (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateDay" title="GDateDay"><span class="type">GDateDay</span></a> day</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateMonth" title="enum GDateMonth"><span class="type">GDateMonth</span></a> month</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="type">GDateYear</span></a> year</code></em>);</pre>
<p>
Like <a class="link" href="glib-Date-and-Time-Functions.html#g-date-new" title="g_date_new ()"><code class="function">g_date_new()</code></a>, but also sets the value of the date. Assuming the
day-month-year triplet you pass in represents an existing day, the
returned date will be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>day</code></em> :</span></p></td>
<td>day of the month</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>month</code></em> :</span></p></td>
<td>month of the year</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>year</code></em> :</span></p></td>
<td>year</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a newly-allocated <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> initialized with <em class="parameter"><code>day</code></em>, <em class="parameter"><code>month</code></em>, and <em class="parameter"><code>year</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-new-julian"></a><h3>g_date_new_julian ()</h3>
<pre class="programlisting"><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="returnvalue">GDate</span></a> *             g_date_new_julian                   (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="type">guint32</span></a> julian_day</code></em>);</pre>
<p>
Like <a class="link" href="glib-Date-and-Time-Functions.html#g-date-new" title="g_date_new ()"><code class="function">g_date_new()</code></a>, but also sets the value of the date. Assuming the
Julian day number you pass in is valid (greater than 0, less than an
unreasonably large number), the returned date will be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>julian_day</code></em> :</span></p></td>
<td>days since January 1, Year 1</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a newly-allocated <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> initialized with <em class="parameter"><code>julian_day</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-clear"></a><h3>g_date_clear ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_clear                        (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> n_dates</code></em>);</pre>
<p>
Initializes one or more <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> structs to a sane but invalid
state. The cleared dates will not represent an existing date, but will
not contain garbage. Useful to init a date declared on the stack.
Validity can be tested with <a class="link" href="glib-Date-and-Time-Functions.html#g-date-valid" title="g_date_valid ()"><code class="function">g_date_valid()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>pointer to one or more dates to clear</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n_dates</code></em> :</span></p></td>
<td>number of dates to clear</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-free"></a><h3>g_date_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_free                         (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);</pre>
<p>
Frees a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> returned from <a class="link" href="glib-Date-and-Time-Functions.html#g-date-new" title="g_date_new ()"><code class="function">g_date_new()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> to free</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-set-day"></a><h3>g_date_set_day ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_set_day                      (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateDay" title="GDateDay"><span class="type">GDateDay</span></a> day</code></em>);</pre>
<p>
Sets the day of the month for a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>. If the resulting
day-month-year triplet is invalid, the date will be invalid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>day</code></em> :</span></p></td>
<td>day to set</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-set-month"></a><h3>g_date_set_month ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_set_month                    (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateMonth" title="enum GDateMonth"><span class="type">GDateMonth</span></a> month</code></em>);</pre>
<p>
Sets the month of the year for a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>.  If the resulting
day-month-year triplet is invalid, the date will be invalid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>month</code></em> :</span></p></td>
<td>month to set</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-set-year"></a><h3>g_date_set_year ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_set_year                     (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="type">GDateYear</span></a> year</code></em>);</pre>
<p>
Sets the year for a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>. If the resulting day-month-year
triplet is invalid, the date will be invalid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>year</code></em> :</span></p></td>
<td>year to set</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-set-dmy"></a><h3>g_date_set_dmy ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_set_dmy                      (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateDay" title="GDateDay"><span class="type">GDateDay</span></a> day</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateMonth" title="enum GDateMonth"><span class="type">GDateMonth</span></a> month</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="type">GDateYear</span></a> y</code></em>);</pre>
<p>
Sets the value of a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> from a day, month, and year.
The day-month-year triplet must be valid; if you aren't
sure it is, call <a class="link" href="glib-Date-and-Time-Functions.html#g-date-valid-dmy" title="g_date_valid_dmy ()"><code class="function">g_date_valid_dmy()</code></a> to check before you
set it.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>day</code></em> :</span></p></td>
<td>day</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>month</code></em> :</span></p></td>
<td>month</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td>
<td>year</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-set-julian"></a><h3>g_date_set_julian ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_set_julian                   (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="type">guint32</span></a> julian_date</code></em>);</pre>
<p>
Sets the value of a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> from a Julian day number.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>julian_date</code></em> :</span></p></td>
<td>Julian day number (days since January 1, Year 1)</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-set-time"></a><h3>g_date_set_time ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_set_time                     (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GTime" title="GTime"><span class="type">GTime</span></a> time_</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_date_set_time</code> has been deprecated since version 2.10 and should not be used in newly-written code. Use <a class="link" href="glib-Date-and-Time-Functions.html#g-date-set-time-t" title="g_date_set_time_t ()"><code class="function">g_date_set_time_t()</code></a> instead.</p>
</div>
<p>
Sets the value of a date from a <a class="link" href="glib-Date-and-Time-Functions.html#GTime" title="GTime"><span class="type">GTime</span></a> value.
The time to date conversion is done using the user's current timezone.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>time_</code></em> :</span></p></td>
<td>
<a class="link" href="glib-Date-and-Time-Functions.html#GTime" title="GTime"><span class="type">GTime</span></a> value to set.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-set-time-t"></a><h3>g_date_set_time_t ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_set_time_t                   (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><span class="type">time_t</span> timet</code></em>);</pre>
<p>
Sets the value of a date to the date corresponding to a time 
specified as a time_t. The time to date conversion is done using 
the user's current timezone.
</p>
<p>
To set the value of a date to the current day, you could write:
</p>
<div class="informalexample"><pre class="programlisting">
 g_date_set_time_t (date, time (NULL)); 
</pre></div>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>timet</code></em> :</span></p></td>
<td>
<span class="type">time_t</span> value to set</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.10</p>
</div>
<hr>
<div class="refsect2">
<a name="g-date-set-time-val"></a><h3>g_date_set_time_val ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_set_time_val                 (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="struct GTimeVal"><span class="type">GTimeVal</span></a> *timeval</code></em>);</pre>
<p>
Sets the value of a date from a <a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="struct GTimeVal"><span class="type">GTimeVal</span></a> value.  Note that the
<em class="parameter"><code>tv_usec</code></em> member is ignored, because <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> can't make use of the
additional precision.
</p>
<p>
The time to date conversion is done using the user's current timezone.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>timeval</code></em> :</span></p></td>
<td>
<a class="link" href="glib-Date-and-Time-Functions.html#GTimeVal" title="struct GTimeVal"><span class="type">GTimeVal</span></a> value to set</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.10</p>
</div>
<hr>
<div class="refsect2">
<a name="g-date-set-parse"></a><h3>g_date_set_parse ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_set_parse                    (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>);</pre>
<p>
Parses a user-inputted string <em class="parameter"><code>str</code></em>, and try to figure out what date it
represents, taking the <a class="link" href="glib-running.html#setlocale" title="区域设置">current locale</a>
into account. If the string is successfully parsed, the date will be
valid after the call. Otherwise, it will be invalid. You should check
using <a class="link" href="glib-Date-and-Time-Functions.html#g-date-valid" title="g_date_valid ()"><code class="function">g_date_valid()</code></a> to see whether the parsing succeeded.
</p>
<p>
This function is not appropriate for file formats and the like; it
isn't very precise, and its exact behavior varies with the locale.
It's intended to be a heuristic routine that guesses what the user
means by a given string (and it does work pretty well in that
capacity).
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> to fill in</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>str</code></em> :</span></p></td>
<td>string to parse</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-add-days"></a><h3>g_date_add_days ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_add_days                     (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> n_days</code></em>);</pre>
<p>
Increments a date some number of days.
To move forward by weeks, add weeks*7 days.
The date must be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> to increment</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n_days</code></em> :</span></p></td>
<td>number of days to move the date forward</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-subtract-days"></a><h3>g_date_subtract_days ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_subtract_days                (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> n_days</code></em>);</pre>
<p>
Moves a date some number of days into the past.
To move by weeks, just move by weeks*7 days.
The date must be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> to decrement</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n_days</code></em> :</span></p></td>
<td>number of days to move</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-add-months"></a><h3>g_date_add_months ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_add_months                   (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> n_months</code></em>);</pre>
<p>
Increments a date by some number of months.
If the day of the month is greater than 28,
this routine may change the day of the month
(because the destination month may not have
the current day in it). The date must be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> to increment</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n_months</code></em> :</span></p></td>
<td>number of months to move forward</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-subtract-months"></a><h3>g_date_subtract_months ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_subtract_months              (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> n_months</code></em>);</pre>
<p>
Moves a date some number of months into the past.
If the current day of the month doesn't exist in
the destination month, the day of the month
may change. The date must be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> to decrement</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n_months</code></em> :</span></p></td>
<td>number of months to move</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-add-years"></a><h3>g_date_add_years ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_add_years                    (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> n_years</code></em>);</pre>
<p>
Increments a date by some number of years.
If the date is February 29, and the destination
year is not a leap year, the date will be changed
to February 28. The date must be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> to increment</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n_years</code></em> :</span></p></td>
<td>number of years to move forward</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-subtract-years"></a><h3>g_date_subtract_years ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_subtract_years               (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> n_years</code></em>);</pre>
<p>
Moves a date some number of years into the past.
If the current day doesn't exist in the destination
year (i.e. it's February 29 and you move to a non-leap-year)
then the day is changed to February 29. The date
must be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> to decrement</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n_years</code></em> :</span></p></td>
<td>number of years to move</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-days-between"></a><h3>g_date_days_between ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a>                g_date_days_between                 (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date1</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date2</code></em>);</pre>
<p>
Computes the number of days between two dates.
If <em class="parameter"><code>date2</code></em> is prior to <em class="parameter"><code>date1</code></em>, the returned value is negative.
Both dates must be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date1</code></em> :</span></p></td>
<td>the first date</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>date2</code></em> :</span></p></td>
<td>the second date</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the number of days between <em class="parameter"><code>date1</code></em> and <em class="parameter"><code>date2</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-compare"></a><h3>g_date_compare ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a>                g_date_compare                      (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *lhs</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *rhs</code></em>);</pre>
<p>
<code class="function">qsort()</code>-style comparison function for dates.
Both dates must be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>lhs</code></em> :</span></p></td>
<td>first date to compare</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>rhs</code></em> :</span></p></td>
<td>second date to compare</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 for equal, less than zero if <em class="parameter"><code>lhs</code></em> is less than <em class="parameter"><code>rhs</code></em>,
greater than zero if <em class="parameter"><code>lhs</code></em> is greater than <em class="parameter"><code>rhs</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-clamp"></a><h3>g_date_clamp ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_clamp                        (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *min_date</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *max_date</code></em>);</pre>
<p>
If <em class="parameter"><code>date</code></em> is prior to <em class="parameter"><code>min_date</code></em>, sets <em class="parameter"><code>date</code></em> equal to <em class="parameter"><code>min_date</code></em>.
If <em class="parameter"><code>date</code></em> falls after <em class="parameter"><code>max_date</code></em>, sets <em class="parameter"><code>date</code></em> equal to <em class="parameter"><code>max_date</code></em>.
Otherwise, <em class="parameter"><code>date</code></em> is unchanged.
Either of <em class="parameter"><code>min_date</code></em> and <em class="parameter"><code>max_date</code></em> may be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.
All non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> dates must be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> to clamp</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>min_date</code></em> :</span></p></td>
<td>minimum accepted value for <em class="parameter"><code>date</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>max_date</code></em> :</span></p></td>
<td>maximum accepted value for <em class="parameter"><code>date</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-order"></a><h3>g_date_order ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_order                        (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date1</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date2</code></em>);</pre>
<p>
Checks if <em class="parameter"><code>date1</code></em> is less than or equal to <em class="parameter"><code>date2</code></em>,
and swap the values if this is not the case.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date1</code></em> :</span></p></td>
<td>the first date</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>date2</code></em> :</span></p></td>
<td>the second date</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-get-day"></a><h3>g_date_get_day ()</h3>
<pre class="programlisting"><a class="link" href="glib-Date-and-Time-Functions.html#GDateDay" title="GDateDay"><span class="returnvalue">GDateDay</span></a>            g_date_get_day                      (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);</pre>
<p>
Returns the day of the month. The date must be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> to extract the day of the month from</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>day of the month</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-get-month"></a><h3>g_date_get_month ()</h3>
<pre class="programlisting"><a class="link" href="glib-Date-and-Time-Functions.html#GDateMonth" title="enum GDateMonth"><span class="returnvalue">GDateMonth</span></a>          g_date_get_month                    (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);</pre>
<p>
Returns the month of the year. The date must be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> to get the month from</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>month of the year as a <a class="link" href="glib-Date-and-Time-Functions.html#GDateMonth" title="enum GDateMonth"><span class="type">GDateMonth</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-get-year"></a><h3>g_date_get_year ()</h3>
<pre class="programlisting"><a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="returnvalue">GDateYear</span></a>           g_date_get_year                     (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);</pre>
<p>
Returns the year of a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>. The date must be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>year in which the date falls</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-get-julian"></a><h3>g_date_get_julian ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="returnvalue">guint32</span></a>             g_date_get_julian                   (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);</pre>
<p>
Returns the Julian day or "serial number" of the <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>. The
Julian day is simply the number of days since January 1, Year 1; i.e.,
January 1, Year 1 is Julian day 1; January 2, Year 1 is Julian day 2,
etc. The date must be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> to extract the Julian day from</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>Julian day</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-get-weekday"></a><h3>g_date_get_weekday ()</h3>
<pre class="programlisting"><a class="link" href="glib-Date-and-Time-Functions.html#GDateWeekday" title="enum GDateWeekday"><span class="returnvalue">GDateWeekday</span></a>        g_date_get_weekday                  (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);</pre>
<p>
Returns the day of the week for a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>. The date must be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>day of the week as a <a class="link" href="glib-Date-and-Time-Functions.html#GDateWeekday" title="enum GDateWeekday"><span class="type">GDateWeekday</span></a>.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-get-day-of-year"></a><h3>g_date_get_day_of_year ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               g_date_get_day_of_year              (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);</pre>
<p>
Returns the day of the year, where Jan 1 is the first day of the
year. The date must be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> to extract day of year from</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>day of the year</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-get-days-in-month"></a><h3>g_date_get_days_in_month ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint8" title="guint8"><span class="returnvalue">guint8</span></a>              g_date_get_days_in_month            (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateMonth" title="enum GDateMonth"><span class="type">GDateMonth</span></a> month</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="type">GDateYear</span></a> year</code></em>);</pre>
<p>
Returns the number of days in a month, taking leap
years into account.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>month</code></em> :</span></p></td>
<td>month</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>year</code></em> :</span></p></td>
<td>year</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>number of days in <em class="parameter"><code>month</code></em> during the <em class="parameter"><code>year</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-is-first-of-month"></a><h3>g_date_is_first_of_month ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_date_is_first_of_month            (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the date is on the first of a month.
The date must be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> to check</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the date is the first of the month</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-is-last-of-month"></a><h3>g_date_is_last_of_month ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_date_is_last_of_month             (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the date is the last day of the month.
The date must be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> to check</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the date is the last day of the month</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-is-leap-year"></a><h3>g_date_is_leap_year ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_date_is_leap_year                 (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="type">GDateYear</span></a> year</code></em>);</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the year is a leap year.
<sup>[<a name="idp15830400" href="#ftn.idp15830400" class="footnote">5</a>]</sup>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>year</code></em> :</span></p></td>
<td>year to check</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the year is a leap year</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-get-monday-week-of-year"></a><h3>g_date_get_monday_week_of_year ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               g_date_get_monday_week_of_year      (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);</pre>
<p>
Returns the week of the year, where weeks are understood to start on
Monday. If the date is before the first Monday of the year, return
0. The date must be valid.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>week of the year</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-get-monday-weeks-in-year"></a><h3>g_date_get_monday_weeks_in_year ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint8" title="guint8"><span class="returnvalue">guint8</span></a>              g_date_get_monday_weeks_in_year     (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="type">GDateYear</span></a> year</code></em>);</pre>
<p>
Returns the number of weeks in the year, where weeks
are taken to start on Monday. Will be 52 or 53. The
date must be valid. (Years always have 52 7-day periods,
plus 1 or 2 extra days depending on whether it's a leap
year. This function is basically telling you how many
Mondays are in the year, i.e. there are 53 Mondays if
one of the extra days happens to be a Monday.)
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>year</code></em> :</span></p></td>
<td>a year</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>number of Mondays in the year</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-get-sunday-week-of-year"></a><h3>g_date_get_sunday_week_of_year ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               g_date_get_sunday_week_of_year      (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);</pre>
<p>
Returns the week of the year during which this date falls, if weeks
are understood to being on Sunday. The date must be valid. Can return
0 if the day is before the first Sunday of the year.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>week number</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-get-sunday-weeks-in-year"></a><h3>g_date_get_sunday_weeks_in_year ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint8" title="guint8"><span class="returnvalue">guint8</span></a>              g_date_get_sunday_weeks_in_year     (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="type">GDateYear</span></a> year</code></em>);</pre>
<p>
Returns the number of weeks in the year, where weeks
are taken to start on Sunday. Will be 52 or 53. The
date must be valid. (Years always have 52 7-day periods,
plus 1 or 2 extra days depending on whether it's a leap
year. This function is basically telling you how many
Sundays are in the year, i.e. there are 53 Sundays if
one of the extra days happens to be a Sunday.)
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>year</code></em> :</span></p></td>
<td>year to count weeks in</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the number of weeks in <em class="parameter"><code>year</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-get-iso8601-week-of-year"></a><h3>g_date_get_iso8601_week_of_year ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="returnvalue">guint</span></a>               g_date_get_iso8601_week_of_year     (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);</pre>
<p>
Returns the week of the year, where weeks are interpreted according
to ISO 8601.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a valid <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>ISO 8601 week number of the year.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.6</p>
</div>
<hr>
<div class="refsect2">
<a name="g-date-strftime"></a><h3>g_date_strftime ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a>               g_date_strftime                     (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *s</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> slen</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);</pre>
<p>
Generates a printed representation of the date, in a
<a class="link" href="glib-running.html#setlocale" title="区域设置">locale</a>-specific way.
Works just like the platform's C library <code class="function">strftime()</code> function,
but only accepts date-related formats; time-related formats
give undefined results. Date must be valid. Unlike <code class="function">strftime()</code>
(which uses the locale encoding), works on a UTF-8 format
string and stores a UTF-8 result.
</p>
<p>
This function does not provide any conversion specifiers in
addition to those implemented by the platform's C library.
For example, don't expect that using <a class="link" href="glib-Date-and-Time-Functions.html#g-date-strftime" title="g_date_strftime ()"><code class="function">g_date_strftime()</code></a> would
make the %F provided by the C99 <code class="function">strftime()</code> work on Windows
where the C library only complies to C89.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>s</code></em> :</span></p></td>
<td>destination buffer</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>slen</code></em> :</span></p></td>
<td>buffer size</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td>
<td>format string</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>valid <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>number of characters written to the buffer, or 0 the buffer was too small</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-to-struct-tm"></a><h3>g_date_to_struct_tm ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_date_to_struct_tm                 (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>,
                                                         <em class="parameter"><code><span class="type">struct tm</span> *tm</code></em>);</pre>
<p>
Fills in the date-related bits of a <span class="structname">struct tm</span>
using the <em class="parameter"><code>date</code></em> value. Initializes the non-date parts with something
sane but meaningless.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> to set the <span class="structname">struct tm</span> from</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>tm</code></em> :</span></p></td>
<td>
<span class="structname">struct tm</span> to fill</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-valid"></a><h3>g_date_valid ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_date_valid                        (<em class="parameter"><code>const <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> *date</code></em>);</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> represents an existing day. The date must not
contain garbage; it should have been initialized with <a class="link" href="glib-Date-and-Time-Functions.html#g-date-clear" title="g_date_clear ()"><code class="function">g_date_clear()</code></a>
if it wasn't allocated by one of the <a class="link" href="glib-Date-and-Time-Functions.html#g-date-new" title="g_date_new ()"><code class="function">g_date_new()</code></a> variants.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>date</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> to check</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>Whether the date is valid</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-valid-day"></a><h3>g_date_valid_day ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_date_valid_day                    (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateDay" title="GDateDay"><span class="type">GDateDay</span></a> day</code></em>);</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the day of the month is valid (a day is valid if it's
between 1 and 31 inclusive).
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>day</code></em> :</span></p></td>
<td>day to check</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the day is valid</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-valid-month"></a><h3>g_date_valid_month ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_date_valid_month                  (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateMonth" title="enum GDateMonth"><span class="type">GDateMonth</span></a> month</code></em>);</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the month value is valid. The 12 <a class="link" href="glib-Date-and-Time-Functions.html#GDateMonth" title="enum GDateMonth"><span class="type">GDateMonth</span></a>
enumeration values are the only valid months.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>month</code></em> :</span></p></td>
<td>month</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the month is valid</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-valid-year"></a><h3>g_date_valid_year ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_date_valid_year                   (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="type">GDateYear</span></a> year</code></em>);</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the year is valid. Any year greater than 0 is valid,
though there is a 16-bit limit to what <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> will understand.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>year</code></em> :</span></p></td>
<td>year</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the year is valid</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-valid-dmy"></a><h3>g_date_valid_dmy ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_date_valid_dmy                    (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateDay" title="GDateDay"><span class="type">GDateDay</span></a> day</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateMonth" title="enum GDateMonth"><span class="type">GDateMonth</span></a> month</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateYear" title="GDateYear"><span class="type">GDateYear</span></a> year</code></em>);</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the day-month-year triplet forms a valid, existing day
in the range of days <a class="link" href="glib-Date-and-Time-Functions.html#GDate" title="struct GDate"><span class="type">GDate</span></a> understands (Year 1 or later, no more than
a few thousand years in the future).
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>day</code></em> :</span></p></td>
<td>day</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>month</code></em> :</span></p></td>
<td>month</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>year</code></em> :</span></p></td>
<td>year</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the date is a valid one</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-valid-julian"></a><h3>g_date_valid_julian ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_date_valid_julian                 (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="type">guint32</span></a> julian_date</code></em>);</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the Julian day is valid. Anything greater than zero
is basically a valid Julian, though there is a 32-bit limit.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>julian_date</code></em> :</span></p></td>
<td>Julian day to check</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the Julian day is valid</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-date-valid-weekday"></a><h3>g_date_valid_weekday ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_date_valid_weekday                (<em class="parameter"><code><a class="link" href="glib-Date-and-Time-Functions.html#GDateWeekday" title="enum GDateWeekday"><span class="type">GDateWeekday</span></a> weekday</code></em>);</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the weekday is valid. The seven <a class="link" href="glib-Date-and-Time-Functions.html#GDateWeekday" title="enum GDateWeekday"><span class="type">GDateWeekday</span></a> enumeration
values are the only valid weekdays.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>weekday</code></em> :</span></p></td>
<td>weekday</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the weekday is valid</td>
</tr>
</tbody>
</table></div>
</div>
</div>
<div class="footnotes">
<br><hr width="100" align="left">
<div class="footnote"><p><sup>[<a id="ftn.idp15830400" href="#idp15830400" class="para">5</a>] </sup>For the purposes of this function,
leap year is every year divisible by 4 unless that year
is divisible by 100. If it is divisible by 100 it would
be a leap year only if that year is also divisible
by 400.</p></div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.18</div>
</body>
</html>